import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:恋恋
 * Date:2022-09-27
 * Time:13:23
 */
public class TestDemo {
    public static void function(int[] A,int m,int[] B,int n){
        int i=m-1;
        int j=n-1;
        int k=m+n-1;
        while( i >= 0 && j >= 0 ){
            if(A[i]<=B[j]){
                A[k]=B[j];
                j--;
                k--;
            }else {
                A[k] = A[i];
                i--;
                k--;
            }
        }
        while(j>=0){
            A[k]=B[j];
            j--;
            k--;
        }
        while(i>=0){
            A[k]=A[i];
            i--;
            k--;
        }
    }
    public static void main(String[] args) {
        int[] A=new int[8];
        A[0]=1;
        A[1]=2;
        A[2]=3;
        int[] B=new int[]{4,5,6};
//        Scanner sc=new Scanner(System.in);
//        for (int i = 0; i < 3; i++) {
//            A[i]= sc.nextInt();
//        }
//        for (int i = 0; i < 3; i++) {
//            B[i]= sc.nextInt();
//        }
//        Arrays.sort(A);
//        Arrays.sort(B);
        function(A,3,B,3);
        System.out.println(Arrays.toString(A));
    }
}
